<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>浮动-父子关系</title>
    <style>
        .f{
            width: 500px;
            border-top: 3px solid cadetblue;
            /* 方式二：清除上方浮动 超出部分隐藏，只有在父元素上设置overflow: hidden;才能生效 */
            overflow: hidden;
        }

        .s1{
            width: 200px;
            height: 200px;
            background-color: orangered;
            /* 浮动  float: left 向左边浮动 ，脱离文档流*/
            float: left;
        }

        .s2{
            width: 200px;
            height: 200px;
            background-color: green;
            /* 行内元素一旦浮动，将会变成inline-block的效果 */
            float: left;
        }

        .other{
            width: 300px;
            height: 300px;
            background-color: yellowgreen;
            /* 方式一：清除上方浮动 clear: left / right / both */
            /* clear: left; */
        }
    </style>
</head>
<body>
    <div class="f">
        <div class="s1"></div>
        <span class="s2">我在这里</span>
    </div>
    <div class="other"></div>
</body>
</html>